<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>San11PK: UTF-8</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">San11PK<span id="projectnumber">&#160;2.2</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.9.6 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','搜索');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">载入中...</div>
<div class="SRStatus" id="Searching">搜索中...</div>
<div class="SRStatus" id="NoMatches">未找到</div>
</div>
</div>
</div>
</div>

</div><!-- top -->
<div><div class="header">
  <div class="headertitle"><div class="title">UTF-8 </div></div>
</div><!--header-->
<div class="contents">
<div class="toc"><h3>目录</h3>
<ul><li class="level1"><a href="#page_utf8_xml">文件说明</a></li>
<li class="level1"><a href="#page_utf8_str">字符串</a></li>
<li class="level1"><a href="#page_utf8_fxn">相关的函数</a></li>
</ul>
</div>
<div class="textblock"><p>描述了 UTF-8 编码的变化。</p>
<h1><a class="anchor" id="page_utf8_xml"></a>
文件说明</h1>
<ul>
<li>两个文件 shiftjis.xml 和 kr enums.cpp 保留 ANSI 编码以实现向后兼容性。</li>
<li>Ini 文件必须具有 UTF-8 BOM 以与 ANSI 版本兼容。<br  />
 xml 和 cpp 文件不需要 BOM，但建议使用它。<br  />
 <img src="ini_utf8.png" alt="" align="left" class="inline"/><br  />
<br  />
<br  />
<br  />
<br  />
<br  />
<br  />
</li>
<li>如果在 xml 文件中使用 UTF-8 编码，则必须在根节点上设置 utf8 属性值。<br  />
 在 UTF-8 编码的 cpp 文件上使用 <a class="el" href="namespacepk.html#abc3688232944766451f4ed4861abac73">pk::load_xml</a> 函数时也是如此。<br  />
 <img src="xml_utf8.png" alt="" align="left" class="inline"/><br  />
<br  />
<br  />
<br  />
<br  />
</li>
<li>使用 ANSI 编码的文件无法在控制台窗口中正确显示。</li>
</ul>
<h1><a class="anchor" id="page_utf8_str"></a>
字符串</h1>
<ul>
<li>对于游戏中显示字符串的函数，如pk::draw_text、pk::message_box、pk::balloon，如果字符串以" \xff\x?? "开头，可以显示在相应的语言。<br  />
但是，encoding.xml 中设置的字体文件是必需的。 <div class="fragment"><div class="line"><a class="code hl_function" href="namespacepk.html#a57cbe755d854589730617855f2b22c6b">pk::draw_text</a>(<span class="stringliteral">&quot;\xff\x01&quot;</span> + <a class="code hl_function" href="namespacepk.html#a14e855b1df526dfa54970a31691473c8">pk::u8encode</a>(<span class="stringliteral">&quot;テスト&quot;</span>, LANG_JP), <a class="code hl_struct" href="structpk_1_1point.html">pk::point</a>(100, 200), -1, FONT_BIG, 0xffff0000);</div>
<div class="line"><a class="code hl_function" href="namespacepk.html#a57cbe755d854589730617855f2b22c6b">pk::draw_text</a>(<span class="stringliteral">&quot;\xff\x02&quot;</span> + <a class="code hl_function" href="namespacepk.html#a14e855b1df526dfa54970a31691473c8">pk::u8encode</a>(<span class="stringliteral">&quot;테스트&quot;</span>, LANG_KR), <a class="code hl_struct" href="structpk_1_1point.html">pk::point</a>(100, 250), -1, FONT_BIG, 0xffff0000);</div>
<div class="line"><a class="code hl_function" href="namespacepk.html#a57cbe755d854589730617855f2b22c6b">pk::draw_text</a>(<span class="stringliteral">&quot;\xff\x03&quot;</span> + <a class="code hl_function" href="namespacepk.html#a14e855b1df526dfa54970a31691473c8">pk::u8encode</a>(<span class="stringliteral">&quot;测试&quot;</span>, LANG_SC), <a class="code hl_struct" href="structpk_1_1point.html">pk::point</a>(100, 300), -1, FONT_BIG, 0xffff0000);</div>
<div class="ttc" id="anamespacepk_html_a14e855b1df526dfa54970a31691473c8"><div class="ttname"><a href="namespacepk.html#a14e855b1df526dfa54970a31691473c8">pk::u8encode</a></div><div class="ttdeci">string u8encode(const string &amp;str, int lang=-1) NOEXCEPT</div><div class="ttdoc">转换成日语</div></div>
<div class="ttc" id="anamespacepk_html_a57cbe755d854589730617855f2b22c6b"><div class="ttname"><a href="namespacepk.html#a57cbe755d854589730617855f2b22c6b">pk::draw_text</a></div><div class="ttdeci">void draw_text(const string &amp;str, const point &amp;pos, uint color=0xffffffff, int fontsize=0, uint outline_color=0xff000000) NOEXCEPT</div></div>
<div class="ttc" id="astructpk_1_1point_html"><div class="ttname"><a href="structpk_1_1point.html">pk::point</a></div><div class="ttdef"><b>Definition:</b> pk_types.h:98</div></div>
</div><!-- fragment --> <img src="encoding.png" alt="" align="left" class="inline"/><br  />
<br  />
<br  />
<br  />
<br  />
<br  />
<br  />
 </li>
</ul>
<h1><a class="anchor" id="page_utf8_fxn"></a>
相关的函数</h1>
<ul>
<li>单击每个函数以获得详细说明。<br  />
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">ANSI   </th><th class="markdownTableHeadNone">UTF-8    </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><br  />
   </td><td class="markdownTableBodyNone"><a class="el" href="namespacepk.html#a5fa026f50ff0faa2df249f41c0aa2028" title="ansi -&gt; utf8">pk::to_utf8</a>    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><br  />
   </td><td class="markdownTableBodyNone"><a class="el" href="namespacepk.html#a1fe20c1fb16af6fb80edf131381d99de" title="utf8 -&gt; ansi">pk::from_utf8</a>    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><a class="el" href="namespacepk.html#a6f50cb442c554667af1d4a622745906f">pk::critical</a>   </td><td class="markdownTableBodyNone"><a class="el" href="namespacepk.html#a676d1b930d0f4fdd436c53b6de3c1ed7" title="写入日志文件">pk::u8critical</a>    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><a class="el" href="namespacepk.html#afde39c6bffdc965918760891d8092722">pk::decode</a>   </td><td class="markdownTableBodyNone"><a class="el" href="namespacepk.html#a258aba64030f223c3d76f1f3f9acc7b6" title="转换成utf8">pk::u8decode</a>    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><a class="el" href="namespacepk.html#a7c908d5f6bf3ae81008fec0ff99fd43e">pk::encode</a>   </td><td class="markdownTableBodyNone"><a class="el" href="namespacepk.html#a14e855b1df526dfa54970a31691473c8" title="转换成日语">pk::u8encode</a>    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><a class="el" href="namespacepk.html#a3bcf6bc97eec23f335f76d4be6983f64">pk::format</a>   </td><td class="markdownTableBodyNone"><a class="el" href="namespacepk.html#ab117546916a3c4321f5b6ad3c193a5b7">pk::u8format</a>    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><a class="el" href="namespacepk.html#a65b32292c64fee6e82e488353e444fed">pk::info</a>   </td><td class="markdownTableBodyNone"><a class="el" href="namespacepk.html#aff807186e260f9081485eb010e0ac027" title="写日志文件">pk::u8info</a>    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><a class="el" href="namespacepk.html#a511ba2523a5d36610e055978709d5ca3">pk::printf</a>   </td><td class="markdownTableBodyNone"><a class="el" href="namespacepk.html#abe6152bb26e033fe09b196936464defc" title="控制台写入">pk::u8printf</a>    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><a class="el" href="namespacepk.html#a42fd640401213fd8d50347475582e927">pk::trace</a>   </td><td class="markdownTableBodyNone"><a class="el" href="namespacepk.html#a076254bd753d7d52b9fd4d712b021a3d" title="写入日志文件">pk::u8trace</a>    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><a class="el" href="namespacepk.html#ab1a46bf9e74e4466b92cd11ed445b67c">pk::warning</a>   </td><td class="markdownTableBodyNone"><a class="el" href="namespacepk.html#a798b6a2c4dfceed70d1433bcfcd63bf4" title="写入日志文件">pk::u8warning</a>   </td></tr>
</table>
</li>
</ul>
</div></div><!-- contents -->
</div><!-- PageDoc -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6
</small></address>
</body>
</html>
